<?php

namespace app\common\model\shopro;

use think\Model;

/**
 * 店铺
 */
class Shop extends Model
{

    // 开启自动写入时间戳字段
    protected $name = 'shopro_shop';
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    // 追加属性
    protected $append = [
        'logo_text',
        'licence_image_text'
    ];

    public function getLogoTextAttr($value,$data)
    {
        if(isset($data['logo']) && $data['logo']){
            $value = cdnurl($data['logo'],true);
        }
        return $value;
    }

    public function getLicenceImageTextAttr($value,$data)
    {
        if(isset($data['licence_image']) && $data['licence_image']){
            $value = cdnurl($data['licence_image'],true);
        }
        return $value;
    }
}
